package cn.sciento.farm.devicemanager.gateway.uplink.service.sensor;

import cn.sciento.farm.devicemanager.dao.entity.DevDevice;
import cn.sciento.farm.devicemanager.gateway.model.uplink.CollectionData;
import cn.sciento.farm.devicemanager.gateway.model.uplink.ControlData;
import cn.sciento.farm.devicemanager.gateway.model.uplink.DeviceStatus;
import cn.sciento.farm.devicemanager.gateway.model.uplink.DeviceSystemPacket;
import cn.sciento.farm.devicemanager.gateway.uplink.service.MessageDisposeService;

/**
 * @author wumu
 * @version V1.0
 * @date 4/26/18
 * @time 8:57 PM
 */
public abstract class AbstractMessageDisposeService implements MessageDisposeService {
    @Override
    public void changeOnline(DeviceStatus deviceStatus) {

    }

    @Override
    public void changeSwitchStatus(String concentrator, String node, int up) {

    }

    @Override
    public void changeCollectionStatus(String concentrator, String node, int up) {

    }

    @Override
    public void changeDeviceData(CollectionData collectionData) {

    }

    @Override
    public void changeSwitch(ControlData controlData) {

    }

    @Override
    public void changeSystem(DeviceSystemPacket systemPacket) {
        if(systemPacket.getUpSerial() != null){
            handleHeart(systemPacket);
        }
        DevDevice devDeviceConcentrator = new DevDevice();
        devDeviceConcentrator.setId(systemPacket.getEui());
        devDeviceConcentrator.setBaud(systemPacket.getBaud());
        devDeviceConcentrator.setPeriod(systemPacket.getPeriod());
        configureSys(devDeviceConcentrator);
    }

    public void handleHeart(DeviceSystemPacket systemPacket){
        return;
    }


    public   void configureSys(DevDevice systemPacket){}
}
